<template>
  <starList v-if="show&&attrs"
   :ref="ref" 
   :config="attrs" 
   :data="anc.dataSet.listData"
   @onload="onload"
   @select="select"></starList>
</template>

<script>
const ref = "list";
export default {
  name: ref,
  components: {},
  inject: ["anc"],
  data() {
    return {
      ref,
      show:false,
      attrs:null,
    };
  },
  props: {},
  watch: {},
  computed: {},
  created() {
    this.beforePageInit();
  },
  mounted() {
    this.$nextTick(() => {
      this.$set(this.anc.vms, this.ref, this);
      this.pageInit();
    });
  },
  methods: {
    /**
     * 页面加载前初始化
     */
    beforePageInit(){
      this.attrs = this.attrsTpl();
      this.show = true;
    },
    /**
     * 页面加载后初始化
     */
    pageInit(){

    },
    /**
     * @description: 获取表格属性
     * @param {*} attr
     * @return {*}
     */
    attrsTpl() {
      return {
        border:false,
        'item-layout':'vertical',//'horizontal',
        header:'',
        footer:'',
        loading:false,
        size:'default',
        split:true,
        mapto:{
            avatar:'avatar',
            title:'title',
            description:'description'
        },
        itemStyle:{},//列表项样式
        action:[],
        extra:[]
      };
    },
    /**
     * 事件：表格加载后获取表格实例
     * @param tableIns 表格实例，相当于 this.$refs[this.ref]
     */
    load(tableIns){

    },
    select(item,data){

    },
    toggleLoading(){
      this.$set(this.attrs,'loading',!this.attrs.loading);
    }
  },
};
</script>
<style scoped></style>
